package com.ctl.juc.atomic;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicIntegerTest {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger();
        atomicInteger.compareAndSet(1,2);
        System.out.println(atomicInteger.get());
        atomicInteger = new AtomicInteger();
        System.out.println("-----------------------------------------------------------------");
        System.out.println(atomicInteger.incrementAndGet());//自增返回新值
        System.out.println(atomicInteger.getAndIncrement());//自增返回旧值

    }
}
